package com.example.project1.adapter;

import java.util.List;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.project1.R;
import com.example.project1.entity.User;

public class YongHuListAdapter extends com.example.project1.adapter.BaseAdapter<User>{

	public YongHuListAdapter(Context context, List<User> data) {
		
		super(context, data);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		ViewHolder holder;
		if(convertView==null){
			convertView=getInflater().inflate(R.layout.item_list_yonghu, null);
			holder=new ViewHolder();
			holder.name=(TextView) convertView.findViewById(R.id.tv_name_list_yonghu);
			holder.time=(TextView) convertView.findViewById(R.id.tv_time_list_yonghu);
			holder.gonghao=(TextView) convertView.findViewById(R.id.tv_gonghao_list_yonghu);
			holder.quanxian=(TextView) convertView.findViewById(R.id.tv_quanxian_list_yonghu);
			convertView.setTag(holder);
		}else{
			holder=(ViewHolder) convertView.getTag();
		}
		
		
			User user=(User) getData().get(position);
			holder.name.setText(user.getName());
			holder.time.setText(user.getTime());
			holder.gonghao.setText(user.getGonghao());
			holder.quanxian.setText(user.getQuanxian());
			
		
		
		return convertView;
	}
	class ViewHolder{
		private TextView name;
		private TextView time;
		private TextView gonghao;
		private TextView quanxian;
	}
}
